-- DisplayObject
-- Created by huanghr
-- 显示用的建筑，没有任何操作

-- 初始化
function initDisplayObject(self)
    self.item:removeAllChildren();

    local class = self.gridData.class;
    local buildingInfo = BuildingBonusM.queryBuildingView(class);

    if not buildingInfo then
        error("获取不到建筑查看配置，元素类型：" .. class);
        return;
    end

    local iconPath = getLevelItemIconPath(buildingInfo["icon"]);
    self.icon = ccui.ImageView:create(iconPath);
    self.item:addChild(self.icon);

    -- 调整位置
    if type(buildingInfo["icon_offset_y"]) == "number" then
        self.icon:setPositionY(self.icon:getPositionY() + buildingInfo["icon_offset_y"]);
    end

    -- 发光
    if self.gridData.need_shining == 1 then
        shiningEffect(self.icon, 70, 100);
    end

    if self.gridData.need_animation == 1 then
        self.needAnimation = true;
    end
end